FROM golang as build

ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct

WORKDIR /GoTorrentCrawler
COPY . .

RUN go build -tags netgo

FROM alpine

# MAINTAINER tzwsoho "tzwsoho@126.com"

WORKDIR /GoTorrentCrawler

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add tzdata 
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
RUN echo "Asia/Shanghai" > /etc/timezone

COPY --from=build /GoTorrentCrawler/config.json /GoTorrentCrawler/config.json
COPY --from=build /GoTorrentCrawler/TorrentCrawler /GoTorrentCrawler/TorrentCrawler

CMD ["./TorrentCrawler"]
